﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:usr="clr-namespace:WPF.TestEditor.Controls"
                    xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                    xmlns:conv="clr-namespace:MahApps.Metro.Converters;assembly=MahApps.Metro"
                    xmlns:Default="clr-namespace:ICSharpCode.TreeView;assembly=ICSharpCode.TreeView"
                    xmlns:cc="clr-namespace:WPF.TestEditor.Controls.AvalonTextEditor"
                    xmlns:AvalonTree="clr-namespace:ICSharpCode.TreeView;assembly=ICSharpCode.TreeView"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Controls.ToolTipControl.xaml" />
        <ResourceDictionary Source="Controls.TabControl.xaml" />
        <ResourceDictionary Source="Controls.MenuControl.xaml" />
        <ResourceDictionary Source="Controls.BrowserSelector.xaml" />
        <ResourceDictionary Source="Controls.TextEditor.xaml" />
        <ResourceDictionary Source="Controls.ScrollViewer.xaml" />
        <ResourceDictionary Source="Controls.ComboBox.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <conv:ToUpperConverter x:Key="ToUpperConverter" />
    
    <Style TargetType="{x:Type Controls:MetroWindow}" x:Key="metroWindowKey">
        <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
        <Setter Property="Behaviours:StylizedBehaviors.Behaviors">
            <Setter.Value>
                <Behaviours:StylizedBehaviorCollection>
                    <Behaviours:BorderlessWindowBehavior/>
                    <Behaviours:WindowsSettingBehaviour/>
                </Behaviours:StylizedBehaviorCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
    </Style>

    <ControlTemplate  x:Key="WindowTemplateKey" TargetType="{x:Type Controls:MetroWindow}">
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
        <Grid >
            <AdornerDecorator>
                <Controls:MetroContentControl>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid x:Name="PART_TitleBar"
                                  Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}"
                                  >
                            <Grid.Background>
                                <SolidColorBrush Color="{DynamicResource AccentColor}"/>
                            </Grid.Background>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Image
                                    Source="{TemplateBinding Icon}"/>
                            <TextBlock
                                    x:Name="WindowTitleTextBlock"
                                    Grid.Column="1"
                                    Text="{TemplateBinding Title}"
                                    HorizontalAlignment="Left" 
                                    TextTrimming="CharacterEllipsis"
                                    VerticalAlignment="Center" 
                                    Margin="8 -1 0 0" 
                                    FontSize="16" 
                                    FontFamily="{DynamicResource HeaderFontFamily}"
                                    Foreground="White"/>
                        </Grid>
                        <ContentPresenter 
                                Content="{Binding WindowCommands, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" 
                                x:Name="PART_WindowCommands"
                                Panel.ZIndex="1"
                                Grid.RowSpan="2"
								VerticalAlignment="Top"
                                HorizontalAlignment="Right"
								Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" />
                        <ContentPresenter Grid.Row="1"/>
                    </Grid>
                </Controls:MetroContentControl>
            </AdornerDecorator>
            <Border x:Name="PART_Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
            <ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom"/>
        </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
                    <Condition Property="WindowState" Value="Normal"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
            </MultiTrigger>
            <Trigger Property="TitleCaps" Value="True">
                <Setter TargetName="WindowTitleTextBlock" Property="Text" Value="{Binding Path=Title, Converter={StaticResource ToUpperConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    


    <Style  x:Key="StandardWindowLabel"  TargetType="{x:Type TextBlock}" >
        <Setter Property="Margin" Value="4,4,4,4"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
    </Style>

    <Style x:Key="StandardTextBox" TargetType="{x:Type TextBox}">
    </Style>



    <Style x:Key="usrTestStepView"  TargetType="{x:Type usr:TestStepView}">
        <Setter Property="TotalResult" Value="NoResult"/>
        <Setter Property="Margin" Value="2 2 5 2"/>
        <Setter Property="Opacity" Value="1"/>
        <Setter Property="Background" Value="{DynamicResource GrayBrush11}" />
        <Setter Property="Foreground" Value="{DynamicResource ItemSelectedBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ItemSelectedBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Style.Triggers>
            <Trigger Property="TotalResult" Value="Failed">
                <Setter Property="Background" Value="#55ff0000"/>
                <Setter Property="BorderBrush" Value="#ffff0000" />
            </Trigger>
            <Trigger Property="TotalResult" Value="Success">
                <Setter Property="Background" Value="#5500ff00"/>
                <Setter Property="BorderBrush" Value="#ff388A34"/>
            </Trigger>
            
            <Trigger Property="TotalResult" Value="InProgress">
                <Setter Property="Background" Value="#55ffff00"/>
                <Setter Property="BorderBrush" Value="#ffffff00" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Opacity" Value="1.0"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="testStepEditor" TargetType="{x:Type usr:TestStepEdit}">
        <Setter Property="Opacity" Value="1"/>
        <Setter Property="Padding" Value="5 2 5 2"/>
        <Setter Property="Background" Value="{DynamicResource GrayBrush7}"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Opacity" Value="1" />
                <Setter Property="Background" Value="{DynamicResource GrayBrush1}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="AutoCompleteWindow" TargetType="Window">
        <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
        <Setter Property="SizeToContent" Value="Height"/>
        <Setter Property="MaxHeight" Value="300"/>
        <Setter Property="Width" Value="175"/>
        <Setter Property="MinHeight" Value="15"/>
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="ShowInTaskbar" Value="False"/>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="AllowsTransparency" Value="True"/>        
        <Setter Property="Padding" Value="5"/>
    </Style>

    <Style x:Key="MetroButton" TargetType="Button" >
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="FontFamily" Value="{DynamicResource DefaultFont}" />
        <Setter Property="Background" Value="{DynamicResource GrayBrush7}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Padding" Value="10,5,10,5" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.7" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.3" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusRectangle">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusInnerRectangle">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                CornerRadius="0" />
                        <Rectangle x:Name="DisabledVisualElement"
                                   Fill="{DynamicResource ControlsDisabledBrush}"
                                   IsHitTestVisible="false"
                                   Opacity="0"
                                   RadiusY="0"
                                   RadiusX="0" />
                        <Border x:Name="MouseOverBorder"
                                Background="{DynamicResource GrayBrush8}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="0"
                                Opacity="0" />
                        <Border x:Name="PressedBorder"
                                Background="{DynamicResource GrayBrush5}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="0"
                                Opacity="0" />
                        <Rectangle x:Name="FocusRectangle"
                                   Stroke="{DynamicResource TextBoxMouseOverInnerBorderBrush}"
                                   RadiusY="0"
                                   RadiusX="0"
                                   Margin="-1"
                                   Opacity="0" />
                        <Rectangle x:Name="FocusInnerRectangle"
                                   StrokeThickness="{TemplateBinding BorderThickness}"
                                   Stroke="{DynamicResource TextBoxMouseOverBorderBrush}"
                                   RadiusX="0"
                                   RadiusY="0"
                                   Opacity="0" />
                        <ContentPresenter x:Name="contentPresenter"
                                          RecognizesAccessKey="True"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content, Converter={StaticResource ToUpperConverter}}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type cc:CompletionList}" x:Key="MetroCompletionList">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type cc:CompletionList}">
                    <Border Margin="0 0 15 15" BorderBrush="{DynamicResource AccenColorBrush}" BorderThickness="1" CornerRadius="0" Background="{DynamicResource AccentDarkColorBrush}" >
                        <cc:CompletitionListBox x:Name="PART_ListBox" ItemContainerStyle="{StaticResource CompletionListBoxItem}" Background="Transparent" BorderThickness="0" Margin="2">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="{Binding Image}" Width="16" Height="16" Margin="0,0,2,0"/>
                                        <ContentControl Content="{Binding Content}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </cc:CompletitionListBox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>